package com.huobao.yunying.activitys_hehuoren;

import java.util.Map;

import org.xutils.view.annotation.ViewInject;

import com.huobao.yunying.https.Http;
import com.huobao.yunying.https.HttpListener;
import com.huobao.yunying.https.HttpUtil;
import com.huobao.yunying.utils.Money;
import com.huobao.zhangying.R;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class Act_Tixian extends Act_TabBase {

	@ViewInject(R.id.edt_search)
	private EditText edt_search;
	@Override
	protected int getContentView() {
		return R.layout.layout_tixian;
	}

	@Override
	protected String getTitleText() {
		// TODO Auto-generated method stub
		return "合伙人-提现";
	}

	private View createRightView() {
		LinearLayout layout = new LinearLayout(context);
		TextView textView = new TextView(context);
		textView.setTextSize(16);
		textView.setBackgroundResource(R.drawable.selector_commect_text_btn);
		textView.setText("提现记录");
		textView.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				Intent intent = new Intent(context, Act_Tixian_Record.class);
				startActivity(intent);
			}
		});
		layout.addView(textView);
		return layout;
	}

	@Override
	protected void init() {
		super.init();
		Money.setPricePoint(edt_search);
		mAbTitleBar.addRightView(createRightView());
		check(null);
	}

	public void onTixianClick(View view){
		String amount_cash = edt_search.getText().toString().trim();
		Map<String, String> map = HttpUtil.getParams("app","partner","act","withdrawals","amount_cash",amount_cash);
		Http.getInstant().sendRequest(context, map, new HttpListener() {
			
			@Override
			public void onHttpSuccess(String result) {
				Toast.makeText(context, "提现成功！", Toast.LENGTH_SHORT).show();
				finish();
			}
			
			@Override
			public void onHttpError(String error) {
				// TODO Auto-generated method stub
				
			}
		});
	}
}
